package dao.impl;

import dao.Conexao;
import dao.DenunciaDAO;
import model.Denuncia;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;

/**
 *
 * @author Robson Vieira
 */
public class DenunciaDAOImpl implements DenunciaDAO{
    private Denuncia denuncia;
    
    public void insert() {
        Session session =  Conexao.getSessionFactory().openSession();
        Transaction transaction = null;
        transaction = session.beginTransaction();
        try {
            session.save(denuncia);
            transaction.commit();
        } catch (HibernateException e) {
            transaction.rollback();
            e.printStackTrace();
        } finally {
            session.close();
        }
    }

    public DenunciaDAOImpl(Denuncia denuncia) {
        this.denuncia = denuncia;
    }
}
